//
//  UIImage+Resize.swift
//  CJBookReader
//
//  Created by colin on 2019/3/25.
//  Copyright © 2019 lidi. All rights reserved.
//

import Foundation
extension UIImage {
    func resizeTo(size:CGSize) -> UIImage? {
        let scale = UIScreen.main.scale
        UIGraphicsBeginImageContextWithOptions(size, false, scale)
        self.draw(in: CGRect(x: 0, y: 0, width: size.width, height: size.height))
        let newImage = UIGraphicsGetImageFromCurrentImageContext()
        UIGraphicsEndImageContext()
        return newImage
    }
}
